// #packager-optimize

(function() {

    var objectModule = {

        merge : function(rootObject, mergedObject) {
            var propertyKey, propertyType, propertyIsObject;

            mergedObject = mergedObject || { };

            for (propertyKey in mergedObject) {
                propertyType = typeof rootObject[propertyKey];
                propertyIsObject = (propertyType == 'object');

                if ( !propertyIsObject ) {
                    rootObject[propertyKey] = mergedObject[propertyKey];
                } else {
                    this.merge(rootObject[propertyKey], mergedObject[propertyKey]);
                }
            }
        },

        getPropertiesCount : function(o) {
            if (typeof o.__count__ == 'undefined') {
                var propertyKey, count = 0;
                for (propertyKey in o) ++count;
                return count;
            } else {
                return o.__count__;
            }
        },

        each : function(object, callback, context) {
            var p;

            for (p in object) {
                callback.call(context, object[p], p);
            }
        }

    };

    juliet.registerModule('juliet.core', 'object-0.1', objectModule);

})();
